package homework01;

import java.util.Arrays;

/**
 * 本类用于实现冒泡排序
 */
public class TestBubbleSort {
    public static void main(String[] args) {

       sort();
    }
    public static void sort( ){
        int[] a = {1, 22, 10, 0, 13, 2, 6, 45};
        for (int j = 1; j < a.length; j++) {

            for (int i = 0; i < a.length - 1; i++) {
                int temp;
                if (a[i] > a[i + 1]) {
                    temp = a[i];
                    a[i] = a[i + 1];
                    a[i + 1] = temp;
                }
            }
            System.out.println("第"+j+"轮:"+Arrays.toString(a));
        }
        System.out.println(Arrays.toString(a));

    }
}
